package com.study.javaFx.model;

import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonIgnoreProperties(ignoreUnknown = true)
public class Machine {
    private final IntegerProperty machineId;
    private final IntegerProperty labId;
    private final IntegerProperty typeId;
    private final StringProperty status;

    public Machine(Integer machineId, Integer labId, Integer typeId, String status) {
        this.machineId = new SimpleIntegerProperty(machineId);
        this.labId = new SimpleIntegerProperty(labId);
        this.typeId = new SimpleIntegerProperty(typeId);
        this.status = new SimpleStringProperty(status);
    }

    public Machine() {
        this.machineId = new SimpleIntegerProperty(0);
        this.labId = new SimpleIntegerProperty(0);
        this.typeId = new SimpleIntegerProperty(0);
        this.status = new SimpleStringProperty("");
    }

    // --- Getter和Setter，带@JsonProperty注解，便于Jackson序列化/反序列化 ---
    @JsonProperty("machineId")
    public int getMachineId() { return machineId.get(); }
    @JsonProperty("machineId")
    public void setMachineId(int id) { this.machineId.set(id); }

    public IntegerProperty machineIdProperty() { return machineId; }

    @JsonProperty("labId")
    public int getLabId() { return labId.get(); }
    @JsonProperty("labId")
    public void setLabId(int id) { this.labId.set(id); }

    public IntegerProperty labIdProperty() { return labId; }

    @JsonProperty("typeId")
    public int getTypeId() { return typeId.get(); }
    @JsonProperty("typeId")
    public void setTypeId(int id) { this.typeId.set(id); }

    public IntegerProperty typeIdProperty() { return typeId; }

    @JsonProperty("status")
    public String getStatus() { return status.get(); }
    @JsonProperty("status")
    public void setStatus(String s) { this.status.set(s); }

    public StringProperty statusProperty() { return status; }
} 